package com.example.sls.controller.field;

import com.example.sls.pojo.field.Fields;
import com.example.sls.service.intserfaces.field.FieldsService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 场地表(Fields)表控制层
 *
 * @author 蓝江富
 * @since 2024-06-19 13:23:43
 */
@RestController
@RequestMapping("field/fields")
public class FieldsController {
  @Autowired
  FieldsService fieldsService;

  @GetMapping("queryById")
  Fields queryById(Integer id) {
    return fieldsService.queryById(id);
  }

  @GetMapping("queryAllByLimit")
  List<Fields> queryAllByLimit(Fields fields, Integer pageSize, Integer offset) {
    return fieldsService.queryAllByLimit(fields, pageSize, offset);
  }

  @GetMapping("count")
  long count() {
    return fieldsService.count();
  }

  @GetMapping("insert")
  int insert(Fields fields) {
    return fieldsService.insert(fields);
  }

  @GetMapping("update")
  int update(Fields fields) {
    return fieldsService.update(fields);
  }

  @GetMapping("deleteById")
  int deleteById(Integer id) {
    return fieldsService.deleteById(id);
  }
}

